package net.zjitc.doubao_community_backed.controller;/**
 * @Author 董熠涛
 * @Date 2025/6/16  20:22
 */

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jakarta.annotation.Resource;
import net.zjitc.doubao_community_backed.api.ApiResult;
import net.zjitc.doubao_community_backed.model.entity.BmsBillboard;
import net.zjitc.doubao_community_backed.service.IBmsBillboardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author:董熠涛
 * @ 2025/6/1620:22
 */
@RestController
@RequestMapping("/billboard")
public class BmsBillboardController {

    @Resource
    private IBmsBillboardService bmsBillboardService;

    @GetMapping("/show")
    @ResponseBody
    public ApiResult<BmsBillboard> getNotices() {
        List<BmsBillboard> list = bmsBillboardService.list(new
                LambdaQueryWrapper<BmsBillboard>().eq(BmsBillboard::isShow, false));
        System.out.println(list.get(list.size() - 1));
        return ApiResult.success(list.get(list.size() - 1));
    }
}
